package com.PVZ.model.plant;

import com.PVZ.model.Anime;
import com.PVZ.model.emuns.AnimeType;
import com.PVZ.model.emuns.Configs;
import com.PVZ.model.emuns.MoveType;
import com.PVZ.model.emuns.PlantType;
import com.PVZ.model.weapon.PeaGun;
import com.PVZ.utils.Util;
import lombok.Getter;
import lombok.Setter;

import java.awt.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by @Author: kabuda on @Date: 2021/5/18 19:26
 */
@Getter
@Setter
public class PeaShooterSingle extends Plant{
    private PeaGun peaGun = new PeaGun(Configs.cardCoolDown.get(PlantType.PeaShooterSingle), 1,this.point, MoveType.Right,new Point(40,10));

    public PeaShooterSingle(int row, int col, MoveType moveType) {
        super(PlantType.PeaShooterSingle, row,col,moveType);
        this.setBoxPadding(-20, -30, 90, 80);
        setAnime();
        setWeapon(peaGun);
    }

    public PeaShooterSingle(){
        super(PlantType.PeaShooterSingle,MoveType.Stop);
        // this.setBoxPadding(-20, -30, 90, 80);
        this.setImgSrc("res/img/plantPng/PeaShooterSingle/PeaShooterSingle-89.png");
        setAnime();
        setWeapon(peaGun);
    }

    @Override
    public void setAnime() {
        Map<AnimeType, Anime> animeMap = new HashMap<>();

        Anime anime = new Anime();
        //图片文件夹地址
        String src = "res/img/plantPng/PeaShooterSingle";
        anime.setAnimeSrc(src);
        anime.setAnimeIndex(0);
        anime.setAnimePlayMode(-1);

        int startIndex = 80;
        int endIndex = 104;

        List<String> animeList = Util.addImageToList(startIndex, endIndex, src,"PeaShooterSingle");
        anime.setAnimeList(animeList);

        //设置当前显示动画的地址
        anime.setCurPic(animeList.get(0));

        animeMap.put(AnimeType.MOVE, anime);

        setAnimeMap(animeMap);
    }

}
